The goals / steps of this project are the following:
In [1]:
import os
import cv2
import glob
import numpy as np
import glob
import matplotlib.image as mpimg
from moviepy.editor import VideoFileClip
import matplotlib.pyplot as plt
from AdvancedLaneLine import AdvancedLaneLine
In [2]:
# try against all test images
images = glob.glob('./test_images/t*.jpg')
for idx, fname in enumerate(images):
print("processing image ({}) ...".format(fname))
file_path_split = os.path.splitext(os.path.basename(fname))
file_name = file_path_split[-2]
advanced_lane_line = AdvancedLaneLine(session=file_name, debug=True)
img = mpimg.imread(fname)
out = advanced_lane_line.image_pipeline(img)
print("Done.")
In [3]:
print("processing project video ...")
# create an instance per video
advanced_lane_line_1 = AdvancedLaneLine(session="session1", debug=False)
input_video = VideoFileClip("./project_video.mp4")
outclip = input_video.fl_image(advanced_lane_line_1.image_pipeline)
outclip.write_videofile("./output/project_video_out.mp4", audio=False)
print("Number of frames using sliding windows : {}, from existing lane info : {}".format(advanced_lane_line_1.sliding_window_count, advanced_lane_line_1.from_existing_count))
print("Done.")
In [5]:
print("processing challenge video ...")
advanced_lane_line_2 = AdvancedLaneLine(session="session2", debug=False)
input_video = VideoFileClip("./challenge_video.mp4")
outclip = input_video.fl_image(advanced_lane_line_2.image_pipeline)
outclip.write_videofile("./output/challenge_video_out.mp4", audio=False)
print("Number of frames using sliding windows : {}, from existing lane info : {}".format(advanced_lane_line_2.sliding_window_count, advanced_lane_line_2.from_existing_count))
print("Done.")